package com.problem;

import java.util.HashSet;
import java.util.Set;

public class s03 {

    String a = "abcdef";

    public static int lengthOfLongestSubstring(String s) {
        Set<Character> subSet = new HashSet<Character>();
        int maxlenth = 0;
        for (int i = 0; i < s.length(); i++) {
            subSet.clear();
            for (int j = i; j < s.length(); j++) {
                if (subSet.contains(s.charAt(j))){
                    break;
                }
                subSet.add(s.charAt(j));
            }
            maxlenth = Math.max(maxlenth,subSet.size());
        }
        return maxlenth;
    }

}
